import App from '../App'
// 布局
const authLayout = r => require.ensure([], () => r(require('../views/auth/layout')), 'auth')
const signin = r => require.ensure([], () => r(require('../views/auth/signin')), 'auth')
const signup = r => require.ensure([], () => r(require('../views/auth/signup')), 'auth')
const resetPassword = r => require.ensure([], () => r(require('../views/auth/reset_password')), 'auth')

const layout = r => require.ensure([], () => r(require('../views/layout')), 'layout')
const index = r => require.ensure([], () => r(require('../views/index/index')), 'index')
const explore = r => require.ensure([], () => r(require('../views/explore/index')), 'explore')
const circle = r => require.ensure([], () => r(require('../views/circle/index')), 'circle')
const project = r => require.ensure([], () => r(require('../views/project/index')), 'project')
const publish = r => require.ensure([], () => r(require('../views/publish/index')), 'publish')

const centerLayout = r => require.ensure([], () => r(require('../views/center/layout')), 'center')
const center = r => require.ensure([], () => r(require('../views/center/index')), 'center')
const setting = r => require.ensure([], () => r(require('../views/center/setting')), 'center')
const mycircle = r => require.ensure([], () => r(require('../views/center/circle')), 'center')
const myproject = r => require.ensure([], () => r(require('../views/center/project')), 'center')
const mystatistics = r => require.ensure([], () => r(require('../views/center/statistics')), 'center')
const push = r => require.ensure([], () => r(require('../views/center/push')), 'center')
const myworkbench = r => require.ensure([], () => r(require('../views/center/workbench')), 'center')
const develop = r => require.ensure([], () => r(require('../views/center/develop')), 'center')

export default [{
  path: '/',
  component: App,
  children: [
    {
      path: '',
      component: layout,
      redirect: '/index',
      children: [
        {path: 'index', component: index, name: 'index', meta: {title: '首页'}},
        {path: 'explore', component: explore, name: 'explore', meta: {title: '发现'}},
        {path: 'circle', component: circle, name: 'circle', meta: {title: '圈子'}},
        {path: 'project', component: project, name: 'project', meta: {title: '项目'}},
        {
          path: 'center',
          component: centerLayout,
          children: [
            {path: '', component: center, name: 'center', meta: {title: '我的'}},
            {path: 'publish', component: publish, name: 'publish', meta: {title: '发布中心'}},
            {path: 'setting', component: setting, name: 'setting', meta: {title: '设置中心'}},
            {path: 'circle', component: mycircle, name: 'mycircle', meta: {title: '我的圈子'}},
            {path: 'project', component: myproject, name: 'myproject', meta: {title: '我的项目'}},
            {path: 'push', component: push, name: 'push', meta: {title: '我的推送'}},
            {path: 'statistics', component: mystatistics, name: 'mystatistics', meta: {title: '我的统计'}},
            {path: 'develop', component: develop, name: 'develop', meta: {title: '开发者'}},
            {path: 'workbench', component: myworkbench, name: 'myworkbench', meta: {title: '我的工作台'}}
          ]
        }
      ]
    },
    {
      path: '',
      component: authLayout,
      children: [
        {path: 'signin', component: signin, name: 'login', meta: {title: '登录'}},
        {path: 'signup', component: signup, name: 'register', meta: {title: '注册'}},
        {path: 'reset_password', component: resetPassword, name: 'reset_password', meta: {title: '找回密码'}}
      ]
    }
  ]
}]
